package com.buobao.spring.ioc;

import com.buobao.spring.ioc.service.DataSource;
import com.buobao.spring.ioc.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Arrays;


public class SpringApplication {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
        //Arrays.stream(applicationContext.getBeanDefinitionNames()).forEach(s->{System.out.println(s);});
        UserService userService = applicationContext.getBean("userService",UserService.class);
        userService.getUserDao();

        DataSource dataSource = applicationContext.getBean("dataSource",DataSource.class);
        System.out.println(dataSource.getMetaData());
    }
}
